package mr

//
// RPC definitions.
//
// remember to capitalize all names.
//

import (
	"os"
	"strconv"
)

//
// example to show how to declare the arguments
// and reply for an RPC.
//

type ExampleArgs struct {
	X int
}

type ExampleReply struct {
	Y int
}

// Add your RPC definitions here.

type TaskKind int

const (
	TaskKindMap TaskKind = iota
	TaskKindReduce
)

type FetchTaskArgs struct {
}

type FetchTaskReply struct {
	Any   bool
	Kind  TaskKind
	Index int
}

type FetchMapTaskArgs struct {
	Index int
}

type FetchMapTaskReply struct {
	Path      string
	Data      string
	NumReduce int
}

type FetchReduceTaskArgs struct {
	Index int
}

type FetchReduceTaskReply struct {
	Paths  []string
	NumMap int
}

type ReportMapTaskArgs struct {
	Index int
	Paths []string
}

type ReportMapTaskReply struct {
}

type ReportReduceTaskArgs struct {
	Index int
}

type ReportReduceTaskReply struct {
}

// Cook up a unique-ish UNIX-domain socket name
// in /var/tmp, for the master.
// Can't use the current directory since
// Athena AFS doesn't support UNIX-domain sockets.
func masterSock() string {
	s := "/var/tmp/824-mr-"
	s += strconv.Itoa(os.Getuid())
	return s
}
